# coding:utf8

from flask import Blueprint, render_template
from admin.core.auth import logon_check


mod = Blueprint("home_index", __name__, template_folder="templates", static_folder="static")


@mod.route("/", methods=["GET"])
@logon_check
def index(*args, **kargs):
    return render_template("home/index.html")


@mod.route("/fontIcon", methods=["GET"])
def fontIcon():
    return render_template("home/fontIcon.html")


@mod.route("/secondSupply/deviceMaintenanceManageStatistical", methods=["GET"])
def deviceMaintenanceManageStatisticalIndex():
    return render_template("secondSupply/deviceMaintenanceStatistical.html")


@mod.route("/secondSupply/lifeMonitoring", methods=["GET"])
def lifeMonitoringIndex():
    return render_template("secondSupply/lifeMonitoring.html")


@mod.route("/secondSupply/inspectionManagement")
def inspectionManagement():
    return render_template("secondSupply/inspectionManagement.html")


@mod.route("/secondSupply/globalMonitoring")
def globalMonitoring():
    return render_template("secondSupply/globalMonitoring.html")


@mod.route("/secondSupply/equipmentGroup")
def equipmentGroup():
    return render_template("secondSupply/equipmentGroup.html")


# @mod.route("/index", methods=["GET"])
# @logon_check
# def index_index(*args, **kargs):
#     return render_template("home/newIndex.html")

# 为index.html第177行的iframe提供支持
#----------------------------------------------
@mod.route("/secondSupply/secondIndex",methods=["GET"])
@logon_check
def secondIndex():
    return render_template("secondSupply/secondIndex.html")


@mod.route("/default",methods=["GET"])
@logon_check
def default_page():
    return render_template("home/default.html")
#----------------------------------------------


@mod.route("/test1",methods=["GET"])
@logon_check
# @permission_check
def test():
    return render_template("home/test1.html")

# @mod.route("/devicelist", methods=["GET"])
# def devicelist(*args, **kargs):
#     new_user.department_id
#     mid = Device.query.all()
#     tmp = []
#     for m in mid:
#         tmp.append(m.to_dict())
#     return jsonify(tmp)


# @mod.route("/gpslist", methods=["GET"])
# def gpslist(*args, **kargs):
#     dd = mongo_store.CK_GPS_Product.__getattr__('D4210507641')
#     rs = dd.find({})
#     tmp = []
#     for d in rs:
#         d.pop('_id')
#         # point = wgs84_baidu(float(d['lon']), float(d['lat']))
#         # d['lon'] = point[0]
#         # d['lat'] = point[1]
#         tmp.append(d)
#     return jsonify(tmp)


# @mod.route("/setting", methods=["GET"])
# def setting():
#     return render_template("home/map_gps.html", **locals())
